/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trefliq.EJB.entities;

import java.io.Serializable;
import javax.persistence.*;

/**
 *
 * @author dsimmons
 */
@Entity
@NamedQueries ({
    @NamedQuery(name="findAllInventory", query="select i from Inventory i"),
    @NamedQuery(name="findInventoryById", query = "SELECT i FROM Inventory i WHERE i.id = :id"),
    @NamedQuery(name="findInventoryByMediaId", query="select i from Inventory i where i.mediaId = :media"),
    @NamedQuery(name="findInventoryByMovie", query="select o from Inventory o where o.movieId = :movie")    
})
public class Inventory implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
//    @NotNull
    @Column(name = "ID", nullable = false)
//    @GeneratedValue(strategy=GenerationType.TABLE, generator="INVENTORY")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    //@JoinColumn(name="MOVIE_ID", referencedColumnName="ID")
    //@ManyToOne(optional=false)
    private Long movieId;

//    @JoinColumn(name="MEDIA_ID", referencedColumnName="ID")
//    @ManyToOne(optional=false)
    private Long mediaId;

    //@Column(name="ITEM_COUNT")
    private Long itemCount;
    
    //@Column(name="ITEMS_AVAILABLE")
    private Long itemsAvailable;
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getItemCount() {
        return itemCount;
    }

    public void setItemCount(Long itemCount) {
        this.itemCount = itemCount;
    }

    public Long getItemsAvailable() {
        return itemsAvailable;
    }

    public void setItemsAvailable(Long itemsAvailable) {
        this.itemsAvailable = itemsAvailable;
    }

    public Long getMovieId() {
        return movieId;
    }

    public void setMovieId(Long movieId) {
        this.movieId = movieId;
    }

    public Long getMediaId() {
        return mediaId;
    }

    public void setMediaId(Long mediaId) {
        this.mediaId = mediaId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Inventory)) {
            return false;
        }
        Inventory other = (Inventory) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "trefliq.persistence.entity.Inventory[ id=" + id + " ]";
    }
    
}
